#pragma once
#include"list.hpp"
#include"stringObject.hpp"
namespace redisStruct
{
	class listObject:redisObject
	{
	public:
		typedef typename list<stringObject*, CopyOfT<stringObject*>, FreeOfT<stringObject*>>::iterator iterator;
		typedef typename list<stringObject*, CopyOfT<stringObject*>, FreeOfT<stringObject*>>::const_iterator const_iterator;

	 private:
		  list<stringObject*, CopyOfT<stringObject*>, FreeOfT<stringObject*>> _list;
	public:
		 listObject():redisObject(TYPE_LIST,TYPE_Encoding_LIST)
		 {}
		 ~listObject()
		 {
		 }
		 listObject(const listObject& other):redisObject(TYPE_LIST, TYPE_Encoding_LIST) ,_list(other._list)
		 {}
		 listObject& operator=(const listObject& other)
		 {
			 _list = other._list;
		 }
		 iterator begin()
		 {
			 return _list.begin();
		 }
		 iterator end()
		 {
			 return _list.end();
		 }
		 bool empty() const
		 {
			 return _list.empty();
		 }
		 size_t size()
		 {
			 return _list.size();
		 }

		 void push_back(stringObject* str)
		 {
			 _list.push_back(str);
		 }
		 void pop_back()
		 {
			 _list.pop_back();
		 }
		 void push_front(stringObject* str)
		 {
			 _list.push_front(str);
		 }
		 void pop_front()
		 {
			 _list.pop_front();
		 }
		 void erase(iterator iter)
		 {
			 _list.erase(iter);
		 }


	};
}